package com.bwie.controller;

import com.bwie.mapper.TbGroupJoinMapper;
import com.bwie.pojo.TbGroupActive;
import com.bwie.pojo.TbGroupJoin;
import com.bwie.service.TbGroupActiveService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/27 20:56
 * @Description:
 **/
@RestController
@RequestMapping("/team/index")
public class IndexController {
    @Autowired
    TbGroupActiveService tbGroupActiveService;

    /**
     * 管理员活动列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getActiveList")
    public R getActiveList(@RequestBody PageInfoVo pageInfoVo){
        return tbGroupActiveService.getActiveList(pageInfoVo);
    }

    /**
     * 添加拼团活动
     * @param tbGroupActive
     * @return
     */
    @PostMapping("/getAddActive")
    public R getAddActive(@RequestBody TbGroupActive tbGroupActive){
        return tbGroupActiveService.getAddActive(tbGroupActive);
    }

    /**
     * 修改拼团活动
     * @param tbGroupActive
     * @return
     */
    @PostMapping("/getUpdateActive")
    public R getUpdateActive(@RequestBody TbGroupActive tbGroupActive){
        return tbGroupActiveService.getUpdateActive(tbGroupActive);
    }

    /**
     * 删除拼团活动
     * @param activeId
     * @return
     */
    @PostMapping("/getDeleteByIdActive/{activeId}")
    public R getDeleteByIdActive(@PathVariable("activeId") Integer activeId){
        return tbGroupActiveService.getDeleteByIdActive(activeId);
    }

    /**
     * 获取活动信息
     * @param activeId
     * @return
     */
    @PostMapping("/getActive/{activeId}")
    public R getActive(@PathVariable("activeId") Integer activeId){
        return tbGroupActiveService.getActive(activeId);
    }

    /**
     * 获取商家参与活动列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getGroupJoinList")
    public R getGroupJoinList(@RequestBody PageInfoVo pageInfoVo){
        return tbGroupActiveService.getGroupJoinList(pageInfoVo);
    }

    /**
     * 添加商家参与活动
     * @param tbGroupJoin
     * @return
     */
    @PostMapping("/addActiveJoin")
    public R addActiveJoin(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupActiveService.addActiveJoin(tbGroupJoin);
    }

    /**
     * 修改商家参与活动
     * @return
     */
    @PostMapping("/updateActiveJoin")
    public R updateActiveJoin(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupActiveService.updateActiveJoin(tbGroupJoin);
    }
    /**
     * 删除商家活动
     * @return
     */
    @PostMapping("/deleteActiveJoin/{joinId}")
    public R deleteActiveJoin(@PathVariable("joinId") Integer joinId){
        return tbGroupActiveService.deleteActiveJoin(joinId);
    }
    /**
     * 参与拼团
     * @return
     */
    @PostMapping("/addActiveRecord")
    public R addActiveRecord(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupActiveService.addActiveRecord(tbGroupJoin);
    }


    /**
     * 获取用户参团列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getRcordsList")
    public R getRcordsList(@RequestBody PageInfoVo pageInfoVo){
        return tbGroupActiveService.getRcordsList(pageInfoVo);
    }
}
